
#include "graphics_ogre.h"

#ifdef __GRAPHICS_OGRE__

using namespace WtfGraphics;

/**
 * Creates graphics data (representation of a renderable object) from an OGRE
 * entity.
 **/
OgreEntity::OgreEntity(const WtfEngine::StringPool::Entry& name)
: GraphicsData(name), mpEntity(Renderer::GetInstance().getSceneMgr()->getEntity(name))
{
	if(!mpEntity) {
		throw std::logic_error("OGRE - entity not found");
	};
};

OgreEntity::~OgreEntity()
{
	// TODO: check for attachment to scene node, remove attachment
	Renderer::GetInstance().getSceneMgr()->destroyEntity(getName());
};
